package cn.wolfcode.trip.api.controller;

import cn.wolfcode.trip.base.domain.Product;
import cn.wolfcode.trip.base.domain.StrategyDetail;
import cn.wolfcode.trip.base.query.ProductQuery;
import cn.wolfcode.trip.base.service.IProductService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("products")
public class ProductController {
    @Autowired
    private IProductService productService;

    //获取所有的上架商品
    @GetMapping
    public PageInfo listAll(ProductQuery qo){

        return productService.query(qo);
    }

    //根据id获取对应的商品信息
    @GetMapping("/{id}")
    public Product getById(@PathVariable Long id) {

        return productService.get(id);
    }

}
